package com.qk.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qk.common.PageResult;
import com.qk.dto.CustomerDto;
import com.qk.entity.Customer;
import com.qk.mapper.CustomerMapper;
import com.qk.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public PageResult<Customer> list(CustomerDto customerDto) {
        PageHelper.startPage(customerDto.getPage(),customerDto.getPageSize());
        List<Customer> customerList = customerMapper.selectList(customerDto);
        Page<Customer> p = (Page<Customer>)customerList;
        return new PageResult<>(p.getTotal(),p.getResult());
    }

}
